<?php defined('IN_IA') or exit('Access Denied');?><?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('base/common-header', TEMPLATE_INCLUDEPATH)) : (include template('base/common-header', TEMPLATE_INCLUDEPATH));?>

<div class="btn-group" role="group" aria-label="...">
    <a href="<?php  echo aurl('update')?>" class="btn btn-success">新增</a>
    <a href="javascript:;" class="btn btn-primary check-all-control">全选</a>
</div>

<form action="javascript:void(0)" id="form_search" class="form-inline" style="float: right" method="GET"
    data-search-ignore="page">
    <input type="text" name="title" class="form-control" value="<?php  echo $_GET['title'];?>" placeholder="搜索标题">
    <select name="service_id">
        <option value="">请选择客服&emsp;</option>
        <?php  if(is_array($services)) { foreach($services as $service) { ?>
        <option value="<?php  echo $service['id'];?>" <?php  if($_GET['service_id']==$service['id'] || $_W['uid']==$service['uid']) { ?>selected<?php  } ?>><?php  echo $service['name'];?>&emsp;
            </option> <?php  } } ?> </select> <select name="cate_id">
        <option value="">请选择分类&emsp;</option>
        <?php  if(is_array($cates)) { foreach($cates as $cate) { ?>
        <option value="<?php  echo $cate['id'];?>" <?php  if($_GET['cate_id']==$cate['id']) { ?>selected<?php  } ?>><?php  echo $cate['name'];?>&emsp; </option> <?php  } } ?>
            </select> <button class="btn btn-warning">搜索</button>
</form>



<form action="javascript:void(0)" method="POST" id="form">
    <table class="table table-hover">
        <thead>
            <tr>
                <th>#</th>
                <th>活动</th>
                <th>属性</th>
                <th>操作</th>
                <th>记录</th>
                <th>预览</th>
            </tr>
        </thead>
        <tbody>
            <?php  if(is_array($list)) { foreach($list as $index => $item) { ?>
            <tr>
                <td><input type="checkbox" name="id[]" class="check-all" value="<?php  echo $item['id'];?>"></td>
                <td>
                    <div>【<?php  echo $item['uni_id'];?>】<b><u><?php  echo $item['title'];?></u></b></div>
                    <div>添加时间：<?php  echo date('Y-m-d H:i:s', $item['create_time'])?></div>
                    <div>结束时间：<?php  echo date('Y-m-d H:i:s', $item['end_time'])?></div>
                    
                    <div>
                        <label class="dropdown label" style="vertical-align: -1px;padding-left:0;padding-right:0">
                            <a id="dLabel" data-target="#" href="javascript:;" class="label label-success" data-toggle="dropdown"
                                role="button" aria-haspopup="true" aria-expanded="false">编辑活动<span class="caret"></span></a>
                            <ul class="dropdown-menu" aria-labelledby="dLabel">
                                <li><a href="<?php  echo aurl('update', ['pid'=>$item['id']])?>"><i class="fa fa-edit"></i>
                                        修改此活动</a></li>
                                <li><a href="<?php  echo aurl('update', ['pid'=>$item['id'], 'copy'=>1])?>"><i class="fa fa-copy"></i>
                                        创建此活动的副本</a></li>
                            </ul>
                        </label>
                        <a href="<?php  echo aurl('robot', ['pid'=>$item['id']])?>" class="label label-warning">
                            虚拟数据设置</a>
                    </div>
                </td>
                <td>
                    <div>
                        状态：<?php  echo $_W['NS']['active_status'][$item['status']];?>
                        &emsp;
                        <?php  if($_W['clerk'] === false) { ?>
                            <?php  if($item['status'] == 'check' || $item['status'] == 'off') { ?>
                            <label><a href="<?php  echo aurl('state')?>" class="label label-info ajax-post confirm" data-id="<?php  echo $item['id'];?>"
                                    data-status="on">启用</a></label>
                            <?php  } ?>
                            <?php  if($item['status'] == 'check' || $item['status'] == 'on') { ?>
                            <label><a href="<?php  echo aurl('state')?>" class="label label-default ajax-post confirm" data-id="<?php  echo $item['id'];?>"
                                    data-status="off">关闭</a></label>
                            <?php  } ?>
                        <?php  } ?>
                    </div>
                    <div>
                        类型：<?php  echo $item['cate_name'];?>
                        &emsp;
                        客服：<?php  echo $item['service_name'];?>
                    </div>
                    <div>价格：<?php  echo $item['price'];?> 元</div>
                </td>
                <td>
                    <div class="row">
                        <span class="col-xs-6">分享页面：</span>
                        <span class="col-xs-6"><label class="label label-primary"><?php  echo $item['share_times'];?></label> 次</span>
                    </div>
                    <div class="row">
                        <span class="col-xs-6">分享奖励：</span>
                        <span class="col-xs-6"><label class="label label-primary"><?php  echo $item['share_times_get_reward'];?></label> 次 <label class="label label-danger">- <?php  echo $item['share_redpack'];?></label> 元</span>
                    </div>
                    <div class="row">
                        <span class="col-xs-6">分享参与量奖励：</span>
                        <span class="col-xs-6"><label class="label label-primary"><?php  echo $item['share_open_times_get_reward'];?></label> 次 <label class="label label-danger">- <?php  echo $item['share_open_redpack'];?></label> 元</span>
                    </div>
                    <div class="row">
                        <span class="col-xs-6">分享点亮：</span>
                        <span class="col-xs-6"><a href="<?php  echo aurl('index', 'signin', ['pid'=>$item['id']])?>" class="label label-primary"><?php  echo $item['signin'];?></a> 次 <label class="label label-danger">- <?php  echo $item['signin_redpack'];?></label> 元</span>
                    </div>
                    <div class="row">
                        <span class="col-xs-6">粉丝推广奖励：</span>
                        <span class="col-xs-6"><a href="<?php  echo aurl('index', 'transfers', ['pid'=>$item['id']])?>" class="label label-primary"><?php  echo $item['ref_times'];?></a> 次 <label class="label label-danger">- <?php  echo $item['ref_redpack'];?></label> 元</span>
                    </div>
                    <div class="row">
                        <span class="col-xs-6">店长奖励：</span>
                        <span class="col-xs-6"><a href="<?php  echo aurl('index', 'transfers', ['pid'=>$item['id']])?>" class="label label-primary"><?php  echo $item['ref_mch_times'];?></a> 次 <label class="label label-danger">- <?php  echo $item['ref_mch_redpack'];?></label> 元</span>
                    </div>
                    <div class="row">
                        <span class="col-xs-6">订单量：</span>
                        <span class="col-xs-6"><a href="<?php  echo aurl('order', ['pid'=>$item['id']])?>" class="label label-primary"><?php  echo $item['orders'];?></a> 单</span>
                    </div>
                </td>
                <td> 
                    <div class="row">
                        <span class="col-xs-6">报名商家：</span>
                        <span class="col-xs-6"><a href="<?php  echo aurl('index', 'mch', ['pid'=>$item['id']])?>" class="label label-primary"><?php  echo $item['mchs'];?></a> 位</span>
                    </div>
                    <div class="row"><span class="col-xs-6">参与量：</span> <span class="col-xs-6"><label class="label label-primary"><?php  echo $item['views'];?></label> 次</span></div>
                    <div class="row"><span class="col-xs-6">浏览量：</span> <span class="col-xs-6"><label class="label label-primary"><?php  echo $item['views_all'];?></label> 次</span></div>
                    <div title="用户报名获得的订单收益" class="row"><span class="col-xs-6">收入：</span> <span class="col-xs-6"><label class="label label-success">+ <?php  echo $item['income'];?></label> 元</span></div>
                    <div title="作为平台发放红包的总金额" class="row"><span class="col-xs-6">支出：</span> <span class="col-xs-6"><label class="label label-danger">- <?php  echo $item['defray'];?></label> 元</span></div>
                    <div title="商家通过此活动充值的金额" class="row"><span class="col-xs-6">商家充值记录：</span> <span class="col-xs-6"><label class="label label-success">+ <?php  echo $item['charge'];?></label> 元</span></div>
                    <div title="商家联系用户发放消息的次数" class="row"><span class="col-xs-6">发放：</span> <span class="col-xs-6"><label class="label label-primary"><?php  echo $item['liaise'];?></label> 次</span></div>
                </td>
                <td>
                    <div><img src="<?php  echo aurl('showActiveQrcode', ['pid'=>$item['id']])?>"></div>
                    <div><a href="javascript:;" class="cliplink" data-text="<?php  echo web2app_url('main', ['pid'=>$item['id']], '', $domainurl)?>"><i
                                class="fa fa-link"></i> 复制活动链接</a></div>
                </td>
            </tr>
            <?php  } } ?>
        </tbody>
    </table>
    <?php  if(empty($list)) { ?> <p class="text-center">暂无数据</p> <?php  } ?>
    <?php  echo $page;?>
</form>

<?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('base/common-footer', TEMPLATE_INCLUDEPATH)) : (include template('base/common-footer', TEMPLATE_INCLUDEPATH));?><script>var we7CommonForModule = document.createElement("script");we7CommonForModule.src = '//cdn.w7.cc/we7/w7windowside.js?v=201904260003';document.body.appendChild(we7CommonForModule)
</script>